package com.htgd.gardenexpo.task;

import com.htgd.gardenexpo.entity.GeConTheaterSeat;
import com.htgd.gardenexpo.service.GeConTheaterSeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author: 王秀田
 * @date: 2024/11/12 14:46
 * @description: TODO
 */
@Component
public class SeatTimeTask {

    @Autowired
    private GeConTheaterSeatService geConTheaterSeatService;

    /**
     * 每天凌晨重置座位
     * cron表达式：表示每天凌晨 执行任务
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void task() {
        System.out.println("task0-start");
        GeConTheaterSeat geConTheaterSeat1 = new GeConTheaterSeat();
        geConTheaterSeat1.setId(1);
        String seat = "[{value:\"1-1\",status:\"0\"},{value:\"1-2\",status:\"0\"},{value:\"1-3\",status:\"0\"},{value:\"1-4\",status:\"0\"},{value:\"1-5\",status:\"0\"},{value:\"1-6\",status:\"0\"},{value:\"1-7\",status:\"0\"},{value:\"1-8\",status:\"0\"},{value:\"1-9\",status:\"0\"},{value:\"2-1\",status:\"0\"},{value:\"2-2\",status:\"0\"},{value:\"2-3\",status:\"0\"},{value:\"2-4\",status:\"0\"},{value:\"2-5\",status:\"0\"},{value:\"2-6\",status:\"0\"},{value:\"2-7\",status:\"0\"},{value:\"2-8\",status:\"0\"},{value:\"2-9\",status:\"0\"},{value:\"2-10\",status:\"0\"},{value:\"2-11\",status:\"0\"},{value:\"2-12\",status:\"0\"},{value:\"3-1\",status:\"0\"},{value:\"3-2\",status:\"0\"},{value:\"3-3\",status:\"0\"},{value:\"3-4\",status:\"0\"},{value:\"3-5\",status:\"0\"},{value:\"3-6\",status:\"0\"},{value:\"3-7\",status:\"0\"},{value:\"3-8\",status:\"0\"},{value:\"3-9\",status:\"0\"},{value:\"3-10\",status:\"0\"},{value:\"3-11\",status:\"0\"},{value:\"3-12\",status:\"0\"},{value:\"4-1\",status:\"0\"},{value:\"4-2\",status:\"0\"},{value:\"4-3\",status:\"0\"},{value:\"4-4\",status:\"0\"},{value:\"4-5\",status:\"0\"},{value:\"4-6\",status:\"0\"},{value:\"4-7\",status:\"0\"},{value:\"4-8\",status:\"0\"},{value:\"4-9\",status:\"0\"},{value:\"4-10\",status:\"0\"},{value:\"4-11\",status:\"0\"},{value:\"4-12\",status:\"0\"},{value:\"5-1\",status:\"0\"},{value:\"5-2\",status:\"0\"},{value:\"5-3\",status:\"0\"},{value:\"5-4\",status:\"0\"},{value:\"5-5\",status:\"0\"},{value:\"5-6\",status:\"0\"},{value:\"5-7\",status:\"0\"},{value:\"5-8\",status:\"0\"},{value:\"5-9\",status:\"0\"},{value:\"5-10\",status:\"0\"},{value:\"5-11\",status:\"0\"},{value:\"5-12\",status:\"0\"},{value:\"6-1\",status:\"0\"},{value:\"6-2\",status:\"0\"},{value:\"6-3\",status:\"0\"},{value:\"6-4\",status:\"0\"},{value:\"6-5\",status:\"0\"},{value:\"6-6\",status:\"0\"},{value:\"6-7\",status:\"0\"},{value:\"6-8\",status:\"0\"},{value:\"6-9\",status:\"0\"},{value:\"6-10\",status:\"0\"},{value:\"6-11\",status:\"0\"}]";
        geConTheaterSeat1.setSeat(seat);
        geConTheaterSeat1.setUpdateTime(LocalDateTime.now());
        geConTheaterSeatService.updateById(geConTheaterSeat1);
        System.out.println("task0-end");
    }


}
